package com.shrcl.engineerprocess.domain.events;

import com.shrcl.engineerprocess.domain.Notification;
import com.shrcl.engineerprocess.domain.events.NotificationEventsListener;
import edu.fudan.mylang.pf.event.EntityEventsManager;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("com.shrcl.engineerprocess.domain.events.NotificationEventsManager")
public class NotificationEventsManager extends EntityEventsManager<Notification> {
  @Autowired(required = false)
  private Collection<NotificationEventsListener> listeners = com.google.common.collect.Lists.newArrayList();;
  
  protected Collection<NotificationEventsListener> getListeners() {
    return listeners;
  }
  
  public void firePerformNotify(final Notification entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((NotificationEventsListener)listener).performNotify(entity);
    }
    
  }
  
  public void fireConfirm(final Notification entity, final String comment) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((NotificationEventsListener)listener).confirm(entity,comment);
    }
    
  }
}
